
#ifndef __CRYPT_INTERFACE_H
#define __CRYPT_INTERFACE_H

#include <cryptlib.h>

class CryptInterface
{
   public:
      CryptInterface();
      ~CryptInterface();
      static int GetErrorDetailCert(CRYPT_CERTIFICATE cert);
      static int GetErrorDetailSession(CRYPT_SESSION sess);
      static int GetErrorDetailObject(CRYPT_HANDLE hand);
      static void CheckCryptError(int status, const char *fpretty, int line);
};

#ifdef __WIN32__
#define fCryptCheckError(s) CryptInterface::CheckCryptError(s, __FILE__, __LINE__)
#else
#define fCryptCheckError(s) CryptInterface::CheckCryptError(s, __PRETTY_FUNCTION__, __LINE__)
#endif

#include <apr_time.h>
#define CRYPT_MAX_RETRIES 3000
#define CRYPT_MAX_TIMESLEEP 1000000

#endif
